package beans;

import mapper.Mapper;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class Unit_Logic_Beans {
    /**
     *根据公司名查询公司信息，来反显个人信息
     * @param unit_beans
     * @return
     */
    public List<Unit_Beans> Select_Unit(Unit_Beans unit_beans){
        SqlSession sqlSession = InitialSqlSession.getSession();
        Mapper mapper = sqlSession.getMapper(Mapper.class);
        List<Unit_Beans> list= mapper.Select_Unit_Message(unit_beans);
        return list;
    }

    public int Insert_Unit(Unit_Beans unit_beans){
        SqlSession sqlSession = InitialSqlSession.getSession();
        Mapper mapper = sqlSession.getMapper(Mapper.class);
        System_Beans system_beans = new System_Beans();
        system_beans.setSEQNAME("UNITACCNUM");

        List<System_Beans>list = mapper.Select_Seq(system_beans);
        int num =  list.get(0).getSEQ();
        unit_beans.setUNITACCNUM(num+"");

       int n =  mapper.Unit_Add(unit_beans);
       return n;

    }

}
